<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改图片信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-images-edit" th:object="${tImages}">
            <input name="sid" th:field="*{sid}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">图片路径：</label>
                <div class="col-sm-8">
                    <input name="src" th:field="*{src}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">图片链接：</label>
                <div class="col-sm-8">
                    <input name="href" th:field="*{href}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">图片标题：</label>
                <div class="col-sm-8">
                    <input name="title" th:field="*{title}" class="form-control" type="text" required>
                </div>
            </div>
            <!--<div class="form-group">-->
                <!--<label class="col-sm-3 control-label is-required">图片类别：</label>-->

                <!--<div class="col-sm-8">-->
                    <!--<select id="type" name="type" class="form-control m-b" required th:with="type=${@dict.getType('dict_image')}">-->
                        <!--<option value="">所有</option>-->
                        <!--<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
                    <!--</select>-->

                    <!--<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 在下方选择 景点id/美食id/游记id</span>-->
                <!--</div>-->
            <!--</div>-->

            <div class="form-group" id="jing">
                <label class="col-sm-3 control-label">景点id：</label>
                <div class="col-sm-8">
                    <input name="jid" th:field="*{jid}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" id="meishi">
                <label class="col-sm-3 control-label">美食id：</label>
                <div class="col-sm-8">
                    <input name="mid" th:field="*{mid}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" id="youji">
                <label class="col-sm-3 control-label">游记id：</label>
                <div class="col-sm-8">
                    <input name="yid" th:field="*{yid}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group" id="jiudian">
                <label class="col-sm-3 control-label">酒店id：</label>
                <div class="col-sm-8">
                    <input name="hid" th:field="*{hid}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">图片排序：</label>
                <div class="col-sm-8">
                    <input name="sort" th:field="*{sort}" class="form-control" type="text" required>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "travel/images";
        $("#form-images-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-images-edit').serialize());
            }
        }

        //监听下拉框操作
        $(function(){
            hideAll();
        })
        function hideAll() {
            $("#jing").hide();
            $("#jiudian").hide();
            $("#youji").hide();
            $("#meishi").hide();
        }
        $("#type").on("change",function () {
            var type = $("#type").val();
            if (type == "meishi") {
                hideAll();
                $("#meishi").show();
            } else if (type == "jingdian") {
                hideAll();
                $("#jing").show();
            } else if (type == "jiudian") {
                hideAll();
                $("#jiudian").show();
            } else if (type == "youji") {
                hideAll();
                $("#youji").show();
            } else {
                hideAll();
            }
        })
    </script>
</body>
</html>
